<%@page import="com.wanmait.cookbook.vo.RecipeType"%>
<%@page import="com.wanmait.cookbook.vo.RecipeTypeSecond"%>
<%@page import="com.wanmait.cookbook.vo.IngredientsTypeSecond"%>
<%@page import="org.apache.jasper.tagplugins.jstl.core.ForEach"%>
<%@page import="com.wanmait.cookbook.vo.IngredientsType"%>
<%@page import="java.util.List"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
    <%String path = request.getContextPath();

    %>
<jsp:include page="/manage/inc/head.jsp"></jsp:include>
<jsp:include page="/manage/inc/menu.jsp"></jsp:include>
    <!--/sidebar-->
    <div class="main-wrap">

        <div class="crumb-wrap">
            <div class="crumb-list"><i class="icon-font"></i><a href="/jscss/admin/design/">首页</a><span class="crumb-step">&gt;</span><a class="crumb-name" href="<%=path%>/FoodManageServlet?action=getAllIngredientsType">食谱类型管理</a><span class="crumb-step">&gt;</span><span>修改二级食谱分类</span></div>
        </div>
        <% RecipeTypeSecond recipeTypeSecond =(RecipeTypeSecond)request.getAttribute("recipeTypeSecond");%>
        <div class="result-wrap">
            <div class="result-content">
                <form action="<%=path %>/CookbookTypeSecondManageServlet?action=updateCookbookTypeSecond&id=<%=recipeTypeSecond.getId() %>" method="post" id="myform" name="myform" >
                    <table class="insert-tab" width="100%">
                        <tbody><tr>
                            <th width="120"><i class="require-red">*</i>类型：</th>
                            <td>
                            	<select name="type" id="catid" class="required">
                            <%List<RecipeType> recipeTypes = (List<RecipeType>)request.getAttribute("recipeTypes");
     	
                            	for(int i=0;i<recipeTypes.size();i++){
                            		
                            		if(recipeTypes.get(i).getId()==recipeTypeSecond.getRecipeType().getId()){
                            %>
                            		<option selected value="<%=recipeTypes.get(i).getId()%>"><%=recipeTypes.get(i).getTitle() %></option>
                            
                            <%}else{ %>
                                    <option  value="<%=recipeTypes.get(i).getId()%>"><%=recipeTypes.get(i).getTitle() %></option>
                            <%} }%> 
                                </select>
                            </td>
                        </tr>
                            <tr>
                                <th><i class="require-red">*</i>食材名称：</th>
                                <td>
                                    <input class="common-text required" id="title" value="<%=recipeTypeSecond.getTitle() %>" name="title" size="50" type="text">
                                    <span id="sp" style="color:red"></span>
                                </td>
                            </tr>
                            <tr>
                                <th></th>
                                <td>
                                    <input id="sub" class="btn btn-primary btn6 mr10" value="提交" type="button">
                                    <input class="btn btn6" onclick="history.go(-1)" value="返回" type="button">
                                </td>
                            </tr>
                        </tbody></table>
                </form>
            </div>
        </div>

    </div>
    <!--/main-->
    <jsp:include page="/manage/inc/foot.jsp"></jsp:include>
     <script>
    $(function(){
    	$("#sub").click(function(){
    		var title =$("#title").val();
    		//判断名称为空
    		if(title==""){
    			$("#title").select();
    			$("#sp").html("不能为空");
    			return;
    		}else{
    			$("#sp").html("");
    			$("#myform").submit();
    		}
    		
    		
    	});
    });
    </script>